<?php

namespace Biz\Models\User;

use Biz\Models\Model;

/**
 * UserClient.
 *
 * @license [http://www.85do.com] [杭州永奥网络科技有限公司]
 * @copyright Copyright (c) 2018-2026 Hangzhou Yongao Technology Co., Ltd. All rights reserved.
 */
class UserClient extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'user_client';

    /**
     * @var array
     */
    protected $fillable = [
        'user_id',
        'contact',
        'institution',
        'address',
    ];

    /**
     * 用户.
     *
     * @var User
     */
    private $_user;

    /**
     * 查询用户.
     */
    public function user()
    {
        return $this->hasOne(User::class, 'id', 'user_id');
    }

    /**
     * 设置用户.
     *
     * @param User $user
     */
    public function setUser(User $user)
    {
        $this->_user = $user;
    }

    /**
     * 获取用户.
     *
     * @return User | null
     */
    public function getUser()
    {
        return $this->_user;
    }
}
